package cn.lyd.base.enm;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum SearchMasterMsgStateEnum {
    //寻主消息状态：0待审核，1已审核，2审核未通过，3已接单，4已完成，5已拒单
    NO_AUDIT(0,"待审核"),
    AUDIT_SUCCESS(1,"已审核"),
    AUDIT_FAIL(2,"审核未通过"),
    ORDER_SUCCESS(3,"已接单"),
    ORDER_FINISH(4,"已完成"),
    ORDER_REJECT(5,"已拒单");

    public static String getNameByCode(Integer code){
        Optional<SearchMasterMsgStateEnum> first = Arrays.stream(SearchMasterMsgStateEnum.values()).filter(state -> state.getCode() == code)
                .findFirst();
        return first.isPresent()?first.get().getName():"";
    }

    private int code;

    private String name;
}
